package com.ztjava.plugin.weixin;

import java.util.Date;
import java.util.concurrent.ConcurrentHashMap;



public class WeixinKit {
	
	public static WeixinSdk MAIN_SDK;
	
	private static final ConcurrentHashMap<String, WeixinSdk> sdkMap 
										= new ConcurrentHashMap<String, WeixinSdk>();
	
	public static void AddSdk(WeixinSdk weixinSdk){
		sdkMap.put(weixinSdk.getName(), weixinSdk);
		if(MAIN_SDK==null){
			MAIN_SDK = weixinSdk;
		}
	}
	
	public static WeixinSdk use(){
		return MAIN_SDK;
	}
	
	public static WeixinSdk use(String name){
		return sdkMap.get(name);
	}
	
	public static String transfer_customer_service(String touser,String fromuser){
		StringBuilder str = new StringBuilder("<xml>");
		str.append("<ToUserName><![CDATA["+touser+"]]></ToUserName>");
		str.append("<FromUserName><![CDATA["+fromuser+"]]></FromUserName>");
		str.append("<CreateTime>"+(new Date()).getTime()+"</CreateTime>");
		str.append("<MsgType><![CDATA[transfer_customer_service]]></MsgType>");
		str.append("</xml>");
		return str.toString();
	}
}
